package binaryOctopus;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagLayout;
import java.awt.LayoutManager;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * Square panel is a square on a checkers board represented
 * by a Java panel. It has a certain location that it at on
 * the board relative to other squares and it has the ability
 * to have a piece. It also has a background color that must 
 * be added on the creation of the board and based on the 
 * location of the square.
 */
public class SquarePanel extends JButton
{
	//size of each square
	private Dimension size = new Dimension(75, 75);
	//the piece that is on the square, null if no piece on it
	private ClickableImage piece;	
	//location on board of the square
	private int x, y;
	//layout so that the piece is centered when added to square
	private GridBagLayout gbag = new GridBagLayout( );
	
	/**
	 * Construct creates a new square that will be placed on board
	 * @param color The background color of the square
	 * @param x X location of square on board
	 * @param y Y location of square on board
	 */
	public SquarePanel(int x, int y) 
	{
		this.x = x;
		this.y = y;
		
		this.setLayout(gbag);
		this.setSize(size);
	}
	
	/** 
	 * Places an image on the Panel
	 * @param image a specific checker piece
	 * @param x x-location piece will be placed
	 * @param y y-loaction piece will be placed
	 */
//	public void addImage( String image, int x, int y)
//	{
//		this.x = x;
//		this.y = y;
//		
//		
//			
//
//		
//		this.setIcon(new ImageIcon(image));
//		this.validate();
//		
//		
////		image.setRow( x );
////		image.setColumn(y);
////		add(image);
////		piece = image;
//	}

	/**
	 * Removes image from panel
	 * @param x x-location piece will be placed
	 * @param y y-loaction piece will be placed
	 */
//	public void removeImage() 
//	{
//		piece = null;
//	}
	
	public int getmyX()
	{
		return x;
	}
	public int getmyY()
	{
		return y;
	}

}
